package com.heima.baidu.config;

import com.heima.baidu.auth.AccessToken;
import com.heima.baidu.service.BaiDuService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Data
@Configuration
@EnableConfigurationProperties({BaiDuConfigProperties.class})
//当引入FileStorageService接口时
@ConditionalOnClass(BaiDuService.class)
public class BaiDuConfig {

    @Autowired
    private BaiDuConfigProperties baiDuConfigProperties;

    @Bean
    public AccessToken buildMinioClient() {
        return new AccessToken();
    }
}